home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5676 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  73 lines

  1. Path: news.netspace.net.au!usenet
  2. From: randy@netspace.net.au (Patrick Liang)
  3. Newsgroups: comp.lang.c++
  4. Subject: Urgent help needed
  5. Date: 6 Feb 1996 07:17:12 GMT
  6. Organization: internet service
  7. Message-ID: <4f6v9o$ov6@otis.netspace.net.au>
  8. NNTP-Posting-Host: dialup-a1-13.mel.netspace.net.au
  9. X-Newsreader: WinVN 0.92.6+
  10.  
  11. I am doing a program to convert a serial no to date format, the serial no is
  12. representing the seconds elapsed since 01/01/1970. and I using the Visual basic
  13. to call the DLL function(general from Borland C++ version 4).
  14.  
  15. It seems there is no problem to creat the DLL in c 
  16. program, no error message, but when I run the visual basic program which call the
  17. DLL that I created, it generate the GPF(general protection fault).  the following 
  18. is the program code.
  19.  
  20. Please help .  Thank you.
  21.  
  22. /*  This is the def file in C Using Borland C++ */
  23.  
  24. LIBRARY    TEST3
  25. DESCRIPTION  "just testing"
  26. EXETYPE    WINDOWS
  27. CODE    PRELOAD MOVEABLE DISCARDABLE
  28. DATA    PRELOAD MOVEABLE SINGLE
  29. HEAPSIZE  4096
  30. EXPORTS    NUMTODATE
  31.  
  32.  
  33. /*  this is the main c program Using Borland C++ */
  34.  
  35. /* Demonstrates the functions */
  36.  
  37. #include <stdio.h>
  38. #include <time.h>
  39. #include <stdlib.h>
  40. #include <windows.h>
  41.  
  42.  
  43. char FAR PASCAL NUMTODATE(char *argv1)
  44. {
  45.  
  46.     struct tm *ptr;
  47.     char *c, buf1[80];
  48.     long l;
  49.     
  50.      l = atol(argv1);
  51.     
  52.      ptr = localtime(&l);
  53.  
  54.     c = asctime(ptr);
  55.     puts(c);
  56.     
  57.     return *c;
  58. }
  59.  
  60.  
  61. /*  this is the visual basic program */
  62.  
  63.  
  64. Declare Function NUMTODATE Lib "c:\test3.dll" (ByVal DateNum As String) As String 
  65.  
  66. MsgRtn = NUMTODATE(CodeInquire)
  67.  
  68.  
  69. =============================
  70.  
  71.  
  72.  
  73.